<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }
        #all{
            position: relative;
            width: 600px;
            height: 400px;
        }
        #all .face{
            position:absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
        }
        #all .face span{
            width: 150%;
            height: 100%;
            transition: 1s;
        }
        #all  .face1 span{
            background:url(./images/1.jpg);
            transform-origin:top;
        }
        #all:hover  .face1 span{
            transform: rotateX(90deg) translateY(-50%);
        }
        #all  .face2 span{
            background:url(./images/2.jpg);
            transform-origin:bottom;
            transform: rotateX(90deg) translateY(50%);
        }
        #all:hover  .face2 span{
            transform: rotateX(0) translateY(0);
        }
        #all .face span:nth-child(1){
            background-position-x:0;
            transition-delay: 0s;
        }
        #all .face span:nth-child(2){
            background-position-x:-150px;
            transition-delay: 0.2s;
        }
        #all .face span:nth-child(3){
            background-position-x:-300px;
            transition-delay: 0.4s;
        }
        #all .face span:nth-child(4){
            background-position-x:-450px;
            transition-delay: 0.6s;
        }
    </style>
</head>
<body>
    <div id="all">
        <div class="face face1">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div class="face face2">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </div>
    </div>
</body>
</html>